package com.example.litterpainterdemo.db

import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update

//操作数据库的方法
@Dao
interface PictureDao {
    @Insert(onConflict = OnConflictStrategy.IGNORE)
    suspend fun insertData(picture: Picture)

    @Delete
    suspend fun deleteData(picture: Picture)

    @Delete
    suspend fun deleteAll(pictures:List<Picture>)

    @Update
    suspend fun updateData(picture: Picture)

    @Query("select * from picture_table")
    fun queryData():LiveData<List<Picture>>

}